public class Student {
   private String xuehao;
//学号12位
   private String name;
//姓名
   private  String sex;
//性别
    private int menpai;
//门牌
   private int chuangwei;
//床位
    private  String yuanxi;
//院系
    private  String luodong;
//    楼栋
   private  String luoceng;
    //    楼层

    public String getXuehao() {
        return xuehao;
    }

    public void setXuehao(String xuehao) {
        this.xuehao = xuehao;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }
//方法可以加判断，如果乱写可以返回符合 属性的结果
    public void setSex(String sex) {

        if ("男".equals(sex) ||"女".equals(sex)){
            this.sex = sex;
        }else {
            this.sex = "女";
        }

    }

    public int getMenpai() {
        return menpai;
    }

    public void setMenpai(int menpai) {
        this.menpai = menpai;
    }

    public int getChuangwei() {
        return chuangwei;
    }

    public void setChuangwei(int chuangwei) {
        this.chuangwei = chuangwei;
    }

    public String getYuanxi() {
        return yuanxi;
    }

    public void setYuanxi(String yuanxi) {
        this.yuanxi = yuanxi;
    }

    public String getLuodong() {
        return luodong;
    }

    public void setLuodong(String luodong) {
        this.luodong = luodong;
    }

    public String getLuoceng() {
        return luoceng;
    }

    public void setLuoceng(String luoceng) {
        this.luoceng = luoceng;
    }


// ----------------------------------------------------------------------------------------

//   构造方法，创建对象并给对象的属性赋值

//   1.无参数的构造，默认带
    public Student() {
    }
//   2. 有参数的构造
    public Student(String xuehao, String name, String sex, int menpai, int chuangwei, String yuanxi, String luodong, String luoceng) {
        this.xuehao = xuehao;
        this.name = name;
        this.sex = sex;
        this.menpai = menpai;
        this.chuangwei = chuangwei;
        this.yuanxi = yuanxi;
        this.luodong = luodong;
        this.luoceng = luoceng;
    }

    @Override
    public String toString() {
        return "Student{" +
                "xuehao='" + xuehao + '\'' +
                ", name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                ", menpai=" + menpai +
                ", chuangwei=" + chuangwei +
                ", yuanxi='" + yuanxi + '\'' +
                ", luodong='" + luodong + '\'' +
                ", luoceng='" + luoceng + '\'' +
                '}';
    }
}
